<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Off the Record</title>
<script type="text/javascript">
	function deleteUser(userId){
		var flag = confirm("정말 삭제하시겠습니까?");
		if(flag){
			location.href="/OffTheRecord/deleteUserByAdmin.action?userId="+userId;
		} 
	}
</script>
</head>
<body>
<c:import url="../common/top.jsp"></c:import>
<div class="container" style="margin: 60px;"></div>

<div class="container">
<div class="row">
<div class="col-xs-1 col-sm-1 col-md-1 col-lg-1"></div>

<!--  -->
<div class="col-xs-10 col-sm-10 col-md-10 col-lg-10">

<div class="delete-top col-lg-3">
	<c:import url="admin_menu.jsp"/>
</div>

<div class="user-delete-search col-lg-9">

	<!-- 탭 -->
	<div class="bs-example bs-example-tabs" role="tabpanel">
		<ul id="myTab" class="nav nav-tabs" role="tablist">
			<li role="presentation" class="active"><a href="#home" id="home-tab" role="tab" data-toggle="tab" aria-controls="home" aria-expanded="true">회원 삭제 <span class="glyphicon glyphicon-trash"></a></li>
	  	</ul>
	    
	    <div id="myTabContent" class="tab-content">
			<div role="tabpanel" class="tab-pane fade in active" id="home" aria-labelledBy="home-tab">
		   	
		   	<!-- user-delete -->		
			<div class="user-delete col-lg-12" style="padding: 10px;">
				
				<div class="user-id-search col-lg-12" style="background-color: lightgray; border: 1px solid lightgray; border-radius: 5px; padding: 10px;">
					<form class="form" role="form" method="post" action="/OffTheRecord/getOneUserByUserId.action">
						<div class="input-group">
								<input type="text" class="form-control" name="userId" id="id" placeholder="삭제하실 회원 아이디를 검색해주세요">
								<span class="input-group-btn">
								<input type="submit" class="btn btn-default" value="검색"/>
								</span>
						</div>
					</form>
				</div>
				
				<div class="page-header">
				<hr>
				</div>
				
				<div class="table-responsive">	
					<!-- table -->
					<table class="table table-hover">
					
				   		<thead>
				        	<tr>
					          	<th>#</th>
					            <th>회원 아이디</th>
					            <th>정보 보기</th>
					            <th>삭제</th>
				          	</tr>
				        </thead>
				        
				        <tbody>
				        	<c:if test="${fn:length(ulist) == 0}">
							<tr><td colspan="4">검색 결과가 없습니다.</td></tr>
							</c:if> 
							<c:if test="${fn:length(ulist) != 0}">
					        	<c:forEach items="${requestScope.ulist }" var="uvo" varStatus="i">
					        		<tr>
						        		<th>${i.count}</th>
							            <td>${uvo.userId }</td>
							            <td><button class="btn btn-default">정보 보기</button></td>
							            <td><button class="btn btn-default" onclick="deleteUser('${uvo.userId }')">삭제</button></td>
							        </tr>
					        	</c:forEach>
				        	</c:if>         
				     	</tbody>
					</table>
				</div>
				
			</div><!-- End user-delete -->
    
    			<!--  -->
			</div>
						
			</div>
		</div>
	</div><!-- End 탭 -->
	
</div>

<div class="col-xs-1 col-sm-1 col-md-1 col-lg-1"></div>
</div><!-- row -->
</div><!-- container -->
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>  
</body>
</html>